<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
<h:head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>Create survey</title>
	<link rel="stylesheet" type="text/css" href="css/main.css" />
	<link rel="stylesheet" type="text/css" href="css/meniu.css" />
	<link rel="stylesheet" type="text/css" href="css/style.css" />

</h:head>

<h:body>

	<ui:include src="header.xhtml" />
	<h:panelGroup layout="block" id="content">
		<ui:include src="leftMenu.xhtml" />
		<h:panelGroup layout="block" id="contenRight">
			<h:panelGroup layout="block" id="header" style="margin-top: 20px;">
				<ul>
					<li id="selected"><a>Manage groups</a></li>
				</ul>
			</h:panelGroup>
			<h:panelGroup layout="block" id="contentTab">
				<h:form id="form">
					<p:dataTable id="dt" value="#{manageGroupsBean.groups}" var="group"
						paginator="true"
						rows="10"
						paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
						rowsPerPageTemplate="5,10,15">
						<p:column>
							<f:facet name="header">
								<h:outputText value="Group name" />
							</f:facet>
							<h:outputText id="groupName" value="#{group.name}" />
						</p:column>
						<p:column>
							<f:facet name="header">
								<h:outputText value="Users" />
							</f:facet>
							<h:selectOneMenu styleClass="comboBoxSurveyBorder">
								<f:selectItems value="#{group.users}" var="user"
									itemValue="#{user.id}"
									itemLabel="#{user.firstname}  #{user.lastname}" />
							</h:selectOneMenu>
						</p:column>
						<p:column>
							<f:facet name="header">
								<h:outputText value="Add users" />
							</f:facet>
							<h:commandButton style="width: 26px;"
								image="resources/img/add-icon-button-hi.png" immediate="true"
								actionListener="#{manageGroupsBean.edit}"
								action="addUserToGroup.xhtml">
								<f:attribute name="currentGroup" value="#{group}" />
							</h:commandButton>
						</p:column>
						<p:column>
							<f:facet name="header">
								<h:outputText value="Remove users" />
							</f:facet>
							<h:commandButton style="width: 26px;"
								image="resources/img/remove-icon-button-hi.png" immediate="true"
								actionListener="#{manageGroupsBean.edit}"
								action="removeUserFromGroup.xhtml">
								<f:attribute name="currentGroup" value="#{group}" />
							</h:commandButton>
						</p:column>
					</p:dataTable>
					<h:commandButton value="Create new group"
						action="groupCreate.xhtml" styleClass="butoaneAddBook"/>
				</h:form>
			</h:panelGroup>
		</h:panelGroup>
	</h:panelGroup>
</h:body>
</html>